package com.suredy.app.porject.constants;

import org.apache.commons.lang3.StringUtils;

/**
 * 资金名目
 * 
 * @author VIVID.G
 * @since 2015-11-6
 * @version v0.1
 */
public enum MoneyType {

	/* 投标资金 */
	B_GM("购买标书"), // 只需要在新建招标时候填写

	B_BZ("投标保证金"), // 只需要在新建招标时候填写

	B_ZBFWF("中标服务费"), // 中标时填写

	B_CLTB("车辆台班费"),

	B_CL("差旅费"),

	B_XT("餐饮费"),

	B_QT("其他"),

	/* 合同资金 */
	C_ZB("质保金"),

	C_YF("预付款保函"),

	C_LY("履约保函"),

	C_GZ("挂账金额"),

	C_YFK("应付款"),

	C_QT("其他");

	public final static MoneyType[] FOR_BID_PAYOUT;

	public final static MoneyType[] FOR_CONTRACT_PAYOUT;

	static {
		FOR_BID_PAYOUT = new MoneyType[] {B_CLTB, B_CL, B_XT, B_QT};
		FOR_CONTRACT_PAYOUT = new MoneyType[] {C_QT};
	}

	private String value;

	private MoneyType(String value) {
		this.value = value;
	}

	public String getValue() {
		return value;
	}

	public final static MoneyType getByValue(String value) {
		if (StringUtils.isBlank(value))
			return null;

		for (MoneyType mt : MoneyType.values()) {
			if (value.equals(mt.getValue()))
				return mt;
		}

		return null;
	}

}
